package com.tomcat;

import java.io.IOException;
import java.net.Socket;

public class RequestRunnable implements Runnable {
   private Socket socket;
   private HttpRequestAndResponse httpRequestAndResponse;

    public RequestRunnable(Socket socket, HttpRequestAndResponse httpRequestAndResponse) {
        this.socket = socket;
        this.httpRequestAndResponse = httpRequestAndResponse;
    }

    @Override
    public void run() {
        System.out.println(">>"+Thread.currentThread().getName()+"::"+socket);
        try {
            httpRequestAndResponse.httpAccepted(socket);
            httpRequestAndResponse.response(socket);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
